package com.sprouting.personal.model.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.sprouting.personal.annotations.CheckLength;
import com.sprouting.personal.annotations.CheckNotNull;
import com.sprouting.personal.model.common.BaseModel;
import com.sprouting.personal.model.common.jsr.AddGroup;
import com.sprouting.personal.model.common.jsr.UpdGroup;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.util.Date;

/**
 * 音乐收藏
 *
 * @author ：LX（长沙麓谷）
 * @date 创建时间： 2022/9/4 22:23
 */
@Data
@TableName("ps_music")
public class Music extends BaseModel {

    /**
     * 主键
     */
    @TableId
    @CheckNotNull(message = "非法ID", groups = UpdGroup.class)
    @Null(message = "无效ID", groups = AddGroup.class)
    private String id;
    /**
     * 隶属用户
     */
    @CheckNotNull(message = "请选择所属用户", groups = UpdGroup.class)
    private String userId;
    /**
     * 歌曲名
     */
    @CheckLength(min = 1, max = 150, message = "歌曲名称超过长度限制")
    @CheckNotNull(message = "请输入歌曲名")
    private String name;
    /**
     * 音乐类型
     * @see Dict#getId()
     */
    @CheckNotNull(message = "请选择音乐类型")
    private String typeId;
    /**
     * 专辑
     */
    @CheckLength(max = 200, message = "专辑名称超过长度限制")
    private String album;
    /**
     * 歌手
     */
    @CheckNotNull(message = "请输入歌手名称")
    @CheckLength(max = 170, message = "歌手名称超过长度限制")
    private String singer;
    /**
     * 作词
     */
    @CheckLength(max = 170, message = "作词人超过长度限制")
    private String lyrics;
    /**
     * 发行时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date dateOfIssue;
    /**
     * 点评
     */
    private String comment;
    /**
     * 评分
     */
    @NotNull(message = "请对音乐进行评分")
    private Integer grade;

}
